const path = require('path');
module.exports = {
    mode: 'development',
    entry: "./src/index.js",
    output: {
        path: path.join(__dirname, 'dist'),
        filename: "bundle.js"
    },
    module: {
        // https://v4.webpack.docschina.org/loaders/file-loader/#outputpath
        rules: [{
            test: /\.(png|jpg|gif)$/,
            use: {
                loader: 'file-loader',
                options: {
                    // name就是原始名称,hash使用的是MD5算法,ext就是后缀
                    name: '[name]_[hash].[ext]',
                    // 打包到images
                    outputPath: 'images/'
                }
            }
        }, {
            test: /\.css$/,
            use: ['style-loader', 'css-loader','postcss-loader']
        }]
    },
    devServer:{
        static: './src',
        port: 9000
    }
}
